‹#›
Inventor API 中的零件图、部件图和工程图
部件图结构分析范例
Public Sub AssemblyTraversal()
' Get the active document, assuming it's an assembly.
Dim oAsmDoc As AssemblyDocument
oAsmDoc = _InvApplication.ActiveDocument
Call TraverseAsm(oAsmDoc.ComponentDefinition.Occurrences, 1)
End Sub
Private Sub TraverseAsm(ByVal oOccurrences As ComponentOccurrences, ByVal Level As Integer)
' Iterate through the current list of occurrences.
Dim oOcc As ComponentOccurrence
For Each oOcc In oOccurrences
' Print the name of the current occurence.
Debug.Print(Space(Level * 3) & oOcc.Name)
' If the current occurrence is a subassembly then call this sub
' again passing in the collection for the current occurrence.
If oOcc.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Call TraverseAsm(oOcc.SubOccurrences, Level + 1)
End If
Next
End Sub

| Module 05 - Assembly doc\Samples Module 05 VB.Net